<?php


if (!defined('EBY_IN')){
	exit('HACKING NO INFO');
}
class admin extends base{
	public function __construct(){
	parent::__construct();
	}
	public function login($arr,$code=TRUE){
		$strpass = md5($arr['pwd']); 
		$sql="SELECT * FROM ".DB_PREFIX."admins where eby_aname='".$arr['name']."' and eby_apwd='".$strpass."'";
		if($this->chkid($sql)){
			$this->setAdminCookies($arr);
			return 0;
		} else {
			unset($this->lib);return 1;
		}
		
	}
	public function setAdminCookies($arr){
		setcookie('admin[name]',$arr['name'],time()+3600*24);
	}
	public function setPass($arr){
		$strpass = md5($arr['pass']);
		$strsql = "UPDATE ".DB_PREFIX."admins SET eby_aname='".$arr['name']."',eby_apwd='".$strpass."' WHERE eby_aid=1";
		$this->db->getSqlstr($strsql);
		$su = $this->db->updateSql()?true:false;
		return $su;
	}

}
?>